/*
package com.sicau.smarttraceplatform.interceptor;

import com.alibaba.fastjson.JSONObject;
import com.sicau.smarttraceplatform.common.returning.ResultData;
import com.sicau.smarttraceplatform.entity.User;
import org.springframework.util.StringUtils;
import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;

import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import java.io.IOException;

import static com.sicau.smarttraceplatform.common.constants.commonConstants.CURRENT_USER;

*/
/**
 * 用户登录拦截器
 *
 * @author sxt
 * @version : 1.0.0
 *//*

public class UserLoginInterceptor extends HandlerInterceptorAdapter {

    @Override
    public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
        User user = (User) request.getSession().getAttribute(CURRENT_USER);
        if (user == null) {
            doResponse(response, "用户未登录");
            return false;
        }
        return true;
    }

    */
/**
     * 响应信息
     *
     * @param response 当前响应对象
     *//*

    @SuppressWarnings("unused")
    private void doResponse(HttpServletResponse response) {
        doResponse(response, null);
    }

    */
/**
     * 响应信息
     *
     * @param response 当前响应对象
     * @param msg      响应信息msg
     *//*

    private void doResponse(HttpServletResponse response, String msg) {
        response.setContentType("application/json; charset=utf-8");
        ResultData<String> failed = new ResultData<String>().FAILED();
        if (!StringUtils.isEmpty(msg)) {
            failed.setObj(msg);
        }
        try {
            response.getWriter().write(JSONObject.toJSONString(failed));
        } catch (IOException e) {
            e.printStackTrace();
        }
    }


    */
/**
     * 获取cookie值
     *
     * @param request   当前请求
     * @param cookieKey key
     * @return cookie值
     *//*

    @SuppressWarnings("unused")
    private String getCookie(HttpServletRequest request, String cookieKey) {
        Cookie[] cookies = request.getCookies();
        for (Cookie cookie : cookies) {
            if (cookie.getName().toUpperCase().equals(cookieKey.toUpperCase())) {
                return cookie.getValue();
            }
        }
        return null;
    }
}
*/
